<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <table id="app">
        <tr>
            <td>姓名</td>
            <td><input type="text" v-model="user.fullName" disabled></td>
        </tr>
        <tr>
            <td>身份证号：</td>
            <td><input type="text" v-model="user.idNum"></td>
        </tr>
        <tr>
            <td colspan="22">
                <input type="button" value="认证" v-on:click="add()">
            </td>

        </tr>
    </table>
</body>
<script src="script/vue.js"></script>
<script src="script/axios.min.js"></script>
<script src="script/moment.js"></script>
<script>
    new Vue({
        el:"#app",
        data:{
            user:{fullName:''},
            type:''
        },
        methods:{
            add:function () {
                if(this.type==0){
                    axios.post("/api/finance-service-user/borrower/peocheck",this.user).then(
                        (res)=>{
                            if(res.data.success){
                                alert(res.data.message);
                                window.location.href="个人中心-账户设置.html";
                            }else{
                                alert(res.data.message);
                            }
                        }
                    );
                }
                if(this.type==1){
                    axios.post("/api/finance-service-user/investor/peocheck",this.user).then(
                        (res)=>{
                            if(res.data.success){
                                alert(res.data.message);
                                window.location.href="个人中心-账户设置.html";
                            }else{
                                alert(res.data.message);
                            }
                        }
                    );
                }
            }
        },
        mounted(){
            this.user=JSON.parse(sessionStorage.getItem("cususer"));
            this.type=sessionStorage.getItem("type");
        }

    });

</script>
</html>
